<?php

/**
 * Usuario form.
 *
 * @package    auip
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class UsuarioForm extends BaseUsuarioForm
{
  public function configure()
  {
       $this->widgetSchema['id_perfil'] = new sfWidgetFormChoice(array('choices'  => Doctrine_Core::getTable('Usuario')->getTypes(), 'expanded' => false, ));
       $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(
            new sfValidatorSchemaCompare('password2', sfValidatorSchemaCompare::EQUAL, 'password', array('throw_global_error' => true), array('invalid' => "Las dos contraseñas no coinciden")),
            new sfValidatorDoctrineUnique(array('model' => 'Usuario', 'column' => 'email', 'primary_key' => 'id', 'required' => true), array('invalid'=> "Este email ya está en uso"))
        )));

      $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  }
  
  public function getNameTo()
  {
      return 'UsuarioForm';
  }
}
